<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path = request.getContextPath(); request.setCharacterEncoding("UTF-8");
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>">
    <title>意健险数据导出</title>
    <jsp:include page="/WEB-INF/jsp/common/common.jsp"></jsp:include>
    <link href="css/calendar.css"  rel="stylesheet" type="text/css" >
    <link rel="stylesheet" href="<%=path%>/css/zTreeStyle/zTreeStyle.css">
    <script type="text/javascript" src="<%=path%>/js/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript" src="<%=path%>/js/jquery.ztree.excheck-3.5.js"></script>
    <script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
    <style type="text/css">
        .sub-title {
            background: none repeat scroll 0 0 #ffffff;
            font-size: 100%;
            font-weight: bold;
            height: 30px;
            line-height: 30px;
            text-indent: 10px;
            width: 100%;
        }

        #detail
        {
            position:relative;
            width: 200px;
            font-size: 12px;
            background: #fff;
            border: 1px solid #000;
            z-index: 2;
            display: none;
        }

        #detail2
        {
            position:relative;
            width: 200px;
            font-size: 12px;
            background: #fff;
            border: 1px solid #000;
            z-index: 2;
            display: none;
        }
    </style>
    <script language="javascript" type="text/javascript">
        var defaultBranch;//保存默认机构的值
        // 用于存储查询条件
        var lifeConditionMap = {};
        $(document).ready(function() {
            isReadyIframe();
            defaultDate();
            loadPrivilegeBranchSelect();//加载机构下拉框

        });

        function isReadyIframe(){
            var iframe = $(window.parent.document).find("#iframe").length;
            if(iframe==0){
                window.location.href="<%=basePath%>index.jsp";
            }
        }

        //加载机构下拉框
        function loadPrivilegeBranchSelect(){
            $.ajax({
                url : "<%=path%>/lifeExportJsp/queryPrivilegeBranch?"+new Date().getTime(),
                type : 'POST',
                async : false,
                dataType:'json',
                success : function(result) {
                    if(result){
                        if($.validate(result))return;

                        //接口下拉框对象
                        var privilegeBranchSelect = document.getElementById("privilegeBranch");
                        privilegeBranchSelect.length=0;

                        var data = result.data;
                        if(data.length > 0){
                            defaultBranch = data[0].deptCode;

                            for (var i = 0; i < data.length; i++) {
                                var option = new Option();
                                option.text = data[i].deptCname;
                                option.title = data[i].deptCname;
                                option.value = data[i].deptCode;

                                privilegeBranchSelect.add(option);
                            }
                        }
                    }
                }
            });
        }


        //日期格式化
        Date.prototype.format = function(format)
        {
            var o = {
                "M+" : this.getMonth()+1, //month
                "d+" : this.getDate(),    //day
                "h+" : this.getHours(),   //hour
                "m+" : this.getMinutes(), //minute
                "s+" : this.getSeconds(), //second
                "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
                "S" : this.getMilliseconds() //millisecond
            }
            if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
                (this.getFullYear()+"").substr(4 - RegExp.$1.length));
            for(var k in o)if(new RegExp("("+ k +")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length==1 ? o[k] :
                        ("00"+ o[k]).substr((""+ o[k]).length));
            return format;
        }

        //默认带出最近5天的信息
        function defaultDate(){
            var begin=new Date();
            var end=new Date();
            new Date(begin.setDate((new Date().getDate()-5)));
            var begintime= begin.format("yyyy-MM-dd");
            var endtime=end.format("yyyy-MM-dd");
            $("#polSubDateBegin").val(begintime);
            $("#polSubDateEnd").val(endtime);
        }


        //所选机构改变时，清空相关联数据
        function clearBranchRelaField(){
            $("#partnerNo").val("");
        }

        //------------------------------------------ 合作伙伴 开始----------------------------------------------
        //打开合作伙伴 窗口
        function openChannelInfoDiv(pageIndex,obj){
            if(($.trim($('#privilegeBranch').val())).length==0){
                $.message('error',"请先选择机构");
                return;
            }
            $('#channelCode').val('');
            $('#channelName').val('');
            $("#"+obj.id).blur();
            queryTradPartners(pageIndex);
        }

        //查询 合作伙伴
        function queryTradPartners(pageIndex){
            var size = 8;
            var parentDeptCode = $.trim($('#privilegeBranch').val());
            var channelCode = $.trim($('#channelCode').val());
            var channelName = $.trim($('#channelName').val());

            $.openLoading();
            $.ajax({
                url : "<%=path%>/lifePolicyList/queryChannelInfoOfLife",
                type : 'POST',
                async : true,
                data:{
                    pageIndex:pageIndex,
                    size:size,
                    parentDeptCode:parentDeptCode,
                    channelCode:channelCode,
                    channelName:channelName
                },
                dataType:'json',
                success:function(page){
                    $.closeLoading();
                    if($.validate(page))return;

                    var radioObj ="<input class='input_fxk' name='partnerradio' type='radio' value=''>";
                    var fieldNames = "channelCode,channelName";
                    var tableContent = creatTable1(fieldNames,page,radioObj);
                    var tableObj = $("#channelInfoTable");
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);

                    var strPage = creatChannelPage2(pageIndex,6,page.maxPage,"16");
                    var pageDIV = $("#channelInfoPageDIV");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);

                    $('#channelInfoDiv').OpenDiv();

                    bindradio();
                }
            });
        }

        //点击“确定”按钮，选择合作伙伴
        function choosePartner(){
            var selectedPartner = $("input[name='partnerradio']:checked");
            if(selectedPartner.length==0){
                $.message("error", "请选择一个合作伙伴");
                return;
            }
            var selectedPartnerNo = selectedPartner.parent().parent().children(" td:eq(1)").html();
            $('#partnerNo').val(selectedPartnerNo);

            closeCurrentDIV('channelInfoDiv');
        }
        //点击“确定” ，选择 出单机构
        function chooseDept(){
            var selectedDept= $("input[name='deptradio']:checked");
            if(selectedDept.length==0){
                $.message("error", "请选择一个出单机构");
                return;
            }
            var deptCode = selectedDept.parent().parent().children(" td:eq(1)").html();
            $('#dptCde').val(deptCode);

            closeCurrentDIV('deptDiv');
        }
        //------------------------------------------ 合作伙伴 结束----------------------------------------------

        //“重置”查询条件
        function  resetCriteria(){
            $('#searchCariteriaForm input[type!="button"]').val("");
            $('#searchCariteriaForm select[name!="privilegeBranch"]').val("");
            $("#privilegeBranch").val(defaultBranch);//机构置为默认机构
        }

        //设置行样式
        function bindredio(){
            $("input[name='radioOrderNo']").click(function(){
                $("input[name='radioOrderNo']").parent().parent().removeClass("table_highlighter");
                $(this).parent().parent().addClass("table_highlighter");
            });
        }

        function queryOrder(pageIndex){
            if($('#selectType').val() == 0){
                $.message("error", "请选择查询维度");
                return;
            }
            $('#summary_div').hide()
            $("#countValidPolicy").text("0");
            if(pageIndex == null){
                pageIndex = 1;
            }
            if(pageIndex == -1){
                pageIndex = 1;
            }

            var asyncFlag = true;
            if(pageIndex == -1){
                asyncFlag = false;
            }

            var privilegeBranch = $.trim($("#privilegeBranch").val());//机构
            var partnerNo = $.trim($("#partnerNo").val());//合作伙伴代码
            var dptCde = $.trim($("#dptCde").val());//出单机构
            var selectType = $.trim($("#selectType").val());//查询维度
            var lifePlanCode = $.trim($("#lifePlanCode").val());//投保方案号
            var prodInstCode = $.trim($("#prodInstCode").val());//4位产品代码
            var polSubDateBegin = $.trim($("#polSubDateBegin").val());//日期起期
            var polSubDateEnd = $.trim($("#polSubDateEnd").val());	//日期止期
            var policyNo = $.trim($("#policyNo").val());	//保单号
            // TODO  待优化
            $("#orderTable1").hide();
            $("#orderTable2").hide();
            $("#orderTable3").hide();
            $("#orderTable4").hide();
            $('#summary_div').hide()
            $("#countValidPolicy").text("0");
            $.openLoading();
            $.ajax({
                url : "<%=path%>/lifeExportJsp/queryNlifeDateByCriteria",
                type : 'POST',
                data:{
                    pageIndex:pageIndex,
                    privilegeBranch:privilegeBranch,
                    partnerNo:partnerNo,
                    dptCde:dptCde,
                    selectType:selectType,
                    lifePlanCode:lifePlanCode,
                    policyNo:policyNo,
                    prodInstCode:prodInstCode,
                    polSubDateBegin:polSubDateBegin,
                    polSubDateEnd:polSubDateEnd
                },
                success:function(page){
                    $.closeLoading();
                    if($.validate(page))return;
                    if(page.result == 'noChannelInfo'){
                        //清空表格数据
                        $(".orderTable").find("tbody").remove();
                        $("#orderPageDiv").html("");
                        return;
                    }
                    lifeConditionMap=page.map;
                    $("#countValidPolicy").text(page.total);//有效保单笔数
                    $('#summary_div').show()

                    // var fieldNames = "'" + Object.keys(page.data[0]).join(",") + "'";
                    /*var fieldNames;
                    if (page.map.selectType == 1){
                        fieldNames = 'dptCde,channlecode,deptCname,channleName,polno,realName,bbrRealName,certiCode,mobile,endorseNo,productCode,planName,coreProdCode,stateId,payStatus,tIssueTm,beginDate,endDate,endorseDate,validDate,startPremium,sumPremium'
                    }else if (page.map.selectType == 2) {
                        fieldNames = 'dptCde,channlecode,deptCname,channleName,polno,endorseNo,productCode,planName,coreProdCode,stateId,payStatus,tIssueTm,beginDate,endDate,startPremium,sumPremium,payNo,planPayFee,policyNo,extPayNo,planPayDate'
                    }else if (page.map.selectType == 3) {
                        fieldNames = 'dptCde,channlecode,deptCname,channleName,polno,endorseNo,productCode,planName,coreProdCode,stateId,payStatus,tIssueTm,beginDate,endDate,endorseDate,validDate,startPremium,sumPremium'
                    }else if(page.map.selectType == 4) {
                        fieldNames = 'dptCde,channlecode,deptCname,channleName,polno,endorseNo,productCode,planName,coreProdCode,stateId,payStatus,tIssueTm,beginDate,endDate,startPremium,sumPremium,payNo,planPayFee,policyNo,extPayNo,planPayDate,rePayNo,refundFee,effDate,applyPayDate,chgSumPremium'
                    }else if(page.map.selectType == 5) {
                        fieldNames = 'dptCde,channlecode,isHookProduct,deptCname,channleName,polno,applyPayDate,productCode,coreProdCode,beginDate,endorseDate,hookProduct,payNo,planPayFee'
                    }
                    var tableContent = creatTable(fieldNames,page,null);

                    var tableObj = $("#orderTable" + selectType);
                    tableObj.show();
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);


                    var strPage = creatChannelPage(pageIndex,6,page.maxPage,"55");
                    var pageDIV = $("#orderPageDiv");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);

                    bindredio();*/
                }
            });
        }


        //-------------------------设置“合作伙伴”、“错误信息” 展示样式  Begin-------------------------//
        //鼠标悬浮、双击内容上显示完整信息
        function showDatail(obj,location){
            var widthNum = parseInt(location);
            var result=obj.innerHTML;
            if(result!=""){
                var length =obj.scrollWidth;
                if(length>200){
                    var e = arguments.callee.caller.arguments[0]||window.event;
                    var y = e.clientY;
                    var x= document.body.offsetWidth;
                    if(x>460){
                        x=x-widthNum;
                    }
                    var div3 = document.getElementById("detail");
                    document.getElementById("detail").style.display = 'block';
                    div3.style.left=x;
                    div3.style.top=e.clientY;
                    div3.style.position="absolute";
                    $("#input")[0].innerHTML=result;
                }
            }
        }

        //关闭详细信息层
        function closeDatail(){
            document.getElementById("detail").style.display = 'none';
        }

        //双击内容 弹出完整信息层
        function copyDetail(obj,location){
            var result=obj.innerHTML;
            if(result!=""){
                var length =obj.scrollWidth;
                if(length>0){
                    var e = arguments.callee.caller.arguments[0]||window.event;
                    var y = e.clientY;
                    var x= document.body.offsetWidth;
                    if(x>460){
                        x=x-parseInt(location);
                    }
                    var div3 = document.getElementById("detail2");
                    document.getElementById("detail2").style.display = 'block';
                    div3.style.left=x;
                    div3.style.top=e.clientY;
                    div3.style.position="absolute";
                    $("#output")[0].innerHTML=result;
                }
            }
        }

        //关闭“合作伙伴”详细信息弹出层
        function closeDiv(){
            document.getElementById("detail2").style.display = 'none';
        }
        //-------------------------设置“合作伙伴”、“错误信息” 展示样式  End-------------------------//

        //点击文件下载
        function downloadlifePolicyFile(){
            queryOrder(-1);
        }

        //弹出层表格绑定单选按钮事件，选中某个单选按钮，该按钮所在行高亮显示
        function bindradio(){
            $("input[name='partnerradio']").click(function(){
                $("input[name='partnerradio']").parent().parent().removeClass("table_highlighter");
                $(this).parent().parent().addClass("table_highlighter");
            });
        }

        //统一 关闭窗口(传入要关闭DIV的id)
        function closeCurrentDIV(obj){
            $("#"+obj).CloseDiv();
        }

        //点击“详细信息”
        function orderDetailInfo(){
            var orderObj = $("input[name='radioOrderNo']:checked");
            if(orderObj.val()!=undefined){
                queryPolicy();
            }else{
                $.message("error", "请选择一个订单");
            }
        }

        function queryPolicy(pageIndex){
            if(pageIndex == null){
                pageIndex = 1;
            }
            if(pageIndex == -1){
                pageIndex = 1;
            }

            var asyncFlag = true;
            if(pageIndex == -1){
                asyncFlag = false;
            }

            var orderObj = $("input[name='radioOrderNo']:checked");
            //var orderNo = $(orderObj).parent('td').parent('tr')[0].childNodes[1].childNodes[0].html;
            var orderNo = $(orderObj).parent('td').parent('tr')[0].childNodes[6].innerHTML;
            $.openLoading();
            $.ajax({
                url : "<%=path%>/gatewayOrder/queryOrderDetail",
                type : 'POST',
                async : asyncFlag,
                dataType:'json',
                data:{orderNo:orderNo},
                success:function(page){
                    $.closeLoading();
                    if($.validate(page))return;

                    //业务处理
                    var fieldNames = "POLNO,APPNO,PLAN_NAME,PREMIUM,BEGIN_DATE,END_DATE,CODE_NAME,POLICY_TYPE";
                    var tableContent = creatTable1(fieldNames,page,null,null);
                    var tableObj = $("#policyTable");
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);

                    var strPage = creatChannelPage(pageIndex,6,page.maxPage,"56");
                    var pageDIV = $("#policyPageDiv");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);

                    $('#policyListDiv').OpenDiv();
                }
            });
        }
        //打开出单机构窗口
        function openDeptDiv(pageIndex,obj){

            if($.trim($('#privilegeBranch').val()).length == 0){
                $.message("error", "请先选择机构");
                return;
            }

            $('#deptCode').val('');
            $('#deptCname').val('');
            $("#"+obj.id).blur();
            queryCoreDept(pageIndex);
        }
        //查询出单机构
        function queryCoreDept(pageIndex){
            var size = 8;
            var deptCode = $.trim($('#deptCode').val());
            var deptCname = $.trim($('#deptCname').val());
            var parentDeptCode =  $.trim($('#privilegeBranch').val());

            $.openLoading();
            $.ajax({
                url : "<%=path%>/lifePolicyList/queryDeptByDeptAndParentDeptCode",
                type : 'POST',
                async : true,
                data:{
                    size:size,
                    pageIndex:pageIndex,
                    deptCode:deptCode,
                    deptCname:deptCname,
                    parentDeptCode:parentDeptCode
                },
                dataType:'json',
                success:function(page){
                    $.closeLoading();
                    if($.validate(page))return;

                    var radioObj ="<input class='input_fxk' name='deptradio' type='radio' value=''>";
                    var fieldNames = "deptCode,deptCNname";
                    var tableContent = creatTable1(fieldNames,page,radioObj);
                    var tableObj = $("#deptTable");
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);

                    var strPage = creatChannelPage3(pageIndex,6,page.maxPage,"18");
                    var pageDIV = $("#deptPageDIV");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);

                    $("#deptDiv").OpenDiv();

                    bindradio();
                }
            });
        }
        //------------------------------------------ 合作伙伴子机构 开始----------------------------------------------
        //加载subChannelTree
        function openSubChannelTreeDiv(){
            var partnerNo = $.trim($('#partnerNo').val());
            if(partnerNo.length==0){
                $.message("error", "请先选择合作伙伴");
                return;
            }

            $.openLoading();
            $.ajax({
                url : "<%=path%>/gatewayOrder/querySubChannelTree?"+new Date().getTime(),
                type : 'POST',
                async : true,
                data:{
                    parentChannelCode:partnerNo
                },
                dataType:'json',
                success:function(data){
                    $.closeLoading();
                    if($.validate(data))return;

                    if(data.length == 0){
                        $.message("error", "所选合作伙伴下没有合作伙伴子机构");return;
                    }
                    var setting = {
                        check: {
                            enable: true,
                            chkStyle: "radio",
                            radioType: "all"
                        },
                        data: {
                            simpleData: {
                                enable: true
                            }
                        }
                    };

                    $.fn.zTree.init($("#subChannelTree"), setting, data);

                    $("#subChannelTreeDiv").OpenDiv();
                }
            });
        }

        //点击“确定”按钮，选择合作伙伴子机构
        function chooseSubPartner(){
            var subChannelTree = $.fn.zTree.getZTreeObj("subChannelTree");
            if(subChannelTree.getCheckedNodes(true).length==0){
                $.message("error", "请选择一个合作伙伴子机构");
                return;
            }
            var subChannels = subChannelTree.getCheckedNodes(true);
            $("#subPartnerNo").val(subChannels[0].id);

            closeCurrentDIV('subChannelTreeDiv');
        }
        function summaryShow() {
            // 清空
            $('#summary_div').hide()
            $("#countValidPolicy").text("0");
            var privilegeBranch = $.trim($("#privilegeBranch").val());//机构
            var partnerNo = $.trim($("#partnerNo").val());//合作伙伴代码
            var dptCde = $.trim($("#dptCde").val());//出单机构
            var selectType = $.trim($("#selectType").val());//查询维度
            var lifePlanCode = $.trim($("#lifePlanCode").val());//投保方案号
            var policyNo = $.trim($("#policyNo").val());//保单号
            var prodInstCode = $.trim($("#prodInstCode").val());//4位产品代码
            var polSubDateBegin = $.trim($("#polSubDateBegin").val());//日期起期
            var polSubDateEnd = $.trim($("#polSubDateEnd").val());	//日期止期
            $.openLoading();
            $.ajax({
                url : "<%=path%>/lifeExportJsp/queryLifePolicyAll",
                type : 'POST',
                async : true,
                dataType:'json',
                data: {
                    privilegeBranch:privilegeBranch,
                    partnerNo:partnerNo,
                    dptCde:dptCde,
                    selectType:selectType,
                    lifePlanCode:lifePlanCode,
                    policyNo:policyNo,
                    prodInstCode:prodInstCode,
                    polSubDateBegin:polSubDateBegin,
                    polSubDateEnd:polSubDateEnd
                },
                success:function(data){
                    $.closeLoading();
                    console.log(data.total);
                    $("#countValidPolicy").text(data.total);//有效保单笔数
                    $('#summary_div').show()
                }
            });
        }

        // 导出到Excel按钮
        function exportExcel() {
            var selectType = $.trim($("#selectType").val());//查询维度
            var polSubDateBegin = $.trim($("#polSubDateBegin").val());//日期起期
            var polSubDateEnd = $.trim($("#polSubDateEnd").val());	//日期止期
            var queryCondition = "?selectType=" + selectType;
            // 查询条件，false：查询条件全部为空，true查询条件不为空
            var flag = false;
            var num = 0;
            if (lifeConditionMap !== {}) {
                $.map(lifeConditionMap, function (value, key) {
                    //遍历map判断上一次的查询条件是否为空，不为空的拼接为参数
                    if (value !== null && value !== '') {
                        if (num === 0) {
                            queryCondition += "&" + key + "=" + value;
                        } else {
                            queryCondition += "&" + key + "=" + value;
                        }
                        flag = true;
                        num++;
                    }
                })
            }
            if (!flag) {
                $.dialog({
                    type: "warn",
                    content: "查询条件为空，是否全量导出？全量查询将耗费大量时间！<br>请输入查询条件点击查询后再进行导出。",
                    onOk: function () {
                        exportExcelDownload(queryCondition,selectType);
                    }
                })
            } else {
                exportExcelDownload(queryCondition,selectType);
            }
        }

        // 导出为Excel表格的url
        function exportExcelDownload(queryConditionParam) {
            window.open('<%=basePath%>' + "lifeExportJsp/exportExcel" + queryConditionParam);
        }
    </script>
</head>
<body>
<div class="current">
    <table class="current_table_1">
        <tbody>
        <tr class="f2">
            <td><img src="./images/current_1.jpg"></td>
            <td class="current_table_1_td">
                <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                <span style=" color:#136bab; ">统计分析
	                  	<span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>意健险数据导出
	                  </span>
            </td>
            <td><img src="./images/current_3.jpg"></td>
        </tr>
        </tbody>
    </table>
</div>

<!--查询条件及结果表单 -->
<table border="1" class="table_02" style="height:150px">
    <tr height="50px">
        <td colspan="2" align="center">
            <form method="post" id="searchCariteriaForm">
                <table border="0" style="margin: 12px auto;">
                    <tr>
                        <td style="padding-left:40px; border: 0;text-align: right" nowrap="nowrap">机构：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <select class="search_select_1" name="privilegeBranch" id="privilegeBranch" onchange="clearBranchRelaField()" style="width: 224px"></select>
                        </td>
                        <td style="padding-left:40px;border: 0;text-align: right" nowrap="nowrap">出单机构：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px"><input id="dptCde" name="dptCde" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">&nbsp;&nbsp;<input type="button"  class="input_button_5" id="searchDeptBtn" value="请选择" onClick="openDeptDiv(1,this)"/></td>
                        <td style="border: 0;text-align: right" nowrap="nowrap">查询维度：</td>
                        <td style="border: 0 ;text-align: left; padding-right: 70px">
                            <select name="selectType" id="selectType">
                                <option value="0">---请选择---</option>
                                <option value="1">按签单时间</option>
                                <option value="2">按实收时间</option>
                                <option value="3">按批增时间</option>
                                <option value="4">按退保时间</option>
                                <option value="5">魔方产品</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td style="border: 0;text-align: right" nowrap="nowrap">合作伙伴：</td>
                        <td style="border: 0 ;text-align: left; padding-right: 70px"><input name="partnerNo" id="partnerNo" readonly="readonly" onselect="" style=" background-color: #ccc;" class="input_text">&nbsp;&nbsp;<input type="button"  class="input_button_5"  id="searchPartnerBtn" value="请选择" onClick="openChannelInfoDiv(1,this)"/></td>
                        <td style="border: 0;text-align: right;" nowrap="nowrap">投保方案号：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <input type="text" name="lifePlanCode" id="lifePlanCode" class="input_text" style="width:130px;"/>
                        </td>
                        <td style="border: 0;text-align: right;" nowrap="nowrap">4位产品代码：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <input name="prodInstCode" id="prodInstCode" class="input_text" style="width:130px;" size="25"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="border: 0;text-align: right;" nowrap="nowrap">日期：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <input id="polSubDateBegin" name="polSubDateBegin" readonly="readonly" onclick="showCalendar('polSubDateBegin','y-mm-dd');"   class="input_time"/>
                        </td>
                        <td style="border: 0;text-align: right;" nowrap="nowrap">至：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <input id="polSubDateEnd" name="polSubDateEnd" readonly="readonly" onclick="showCalendar('polSubDateEnd','y-mm-dd');"  class="input_time"/>
                        </td>
                        <td style="border: 0;text-align: right;" nowrap="nowrap">保单号：</td>
                        <td style="border: 0;text-align: left;padding-right: 70px">
                            <input id="policyNo" name="policyNo"  class="input_text"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="border: 0;padding-top: 5px;padding-right: 70px">
                            <input type="button"  class="input_button_1"  value="查询"    onClick="queryOrder()"/>
                            <input type="button"  class="input_button_1"  value="重置"    onClick="resetCriteria()"/>
                        </td>
                    </tr>
                </table>
            </form>
        </td>
    </tr>
    <tr>
        <td valign="top">
            <div id="orderDiv" style="width:98%;margin:5px" >
                <div align="left" style="margin:15px">
                    <%-- <input type="button"  class="input_button_2" style="width: 105px; background-size: 100% 100%"  value="按签单时间导出" onClick="exportExcel(1)"/>&nbsp;
                     <input type="button"  class="input_button_2" style="width: 105px; background-size: 100% 100%" value="按实收时间导出" onClick="exportExcel(2)"/>&nbsp;
                     <input type="button"  class="input_button_2" style="width: 105px; background-size: 100% 100%"  value="按批增时间导出" onClick="exportExcel(3)"/>&nbsp;
                     <input type="button"  class="input_button_2" style="width: 105px; background-size: 100% 100%"  value="按退保时间导出" onClick="exportExcel(4)"/>&nbsp;
                     <input type="button"  class="input_button_2" style="width: 125px; background-size: 100% 100%"  value="魔方产品明细导出" onClick="exportExcel(5)"/>&nbsp;
                     <input style="float: right" type="button" align="right"  onclick="summaryShow()" id="summary_btn" class="input_button_2"  value="展示汇总"/>--%>
                    <input type="button"  class="input_button_2" style="width: 105px; background-size: 100% 100%" value="导出数据" onClick="exportExcel()"/>&nbsp;
                    <!-- 汇总点击按钮才展示 -->
                    <div align="right" id="summary_div" style="margin:15px;display:none;">
                        <span>查询条数：</span><span id="countValidPolicy" style="color: red">0</span>条&nbsp;&nbsp;
                    </div>
                </div>
                <div align="right" style="margin:15px">
                </div>
            </div>
        </td>
    </tr>
</table>
<div style="width:100%;overflow: scroll">
    <table class="table_02 orderTable" id="orderTable1" style="width: 3000px; display: none">
        <thead>
        <tr>
            <th nowrap="nowrap" style="width:5%">机构代码</th>
            <th nowrap="nowrap" style="width:5%">渠道代码</th>
            <th nowrap="nowrap" style="width:10%">机构名称</th>
            <th nowrap="nowrap" style="width:5%">渠道名称</th>
            <th nowrap="nowrap" style="width:5%">保单号</th>
            <th nowrap="nowrap" style="width:5%">投保人姓名</th>
            <th nowrap="nowrap" style="width:5%">被保人姓名</th>
            <th nowrap="nowrap" style="width:5%">被保人身份证</th>
            <th nowrap="nowrap" style="width:5%">被保人电话</th>
            <th nowrap="nowrap" style="width:5%">批增单号（针对魔方产品）</th>
            <th nowrap="nowrap" style="width:5%">投保方案号</th>
            <th nowrap="nowrap" style="width:5%">投保方案名称</th>
            <th nowrap="nowrap" style="width:5%">4位产品代码</th>
            <th nowrap="nowrap" style="width:5%">保单状态</th>
            <th nowrap="nowrap" style="width:5%">缴费状态</th>
            <th nowrap="nowrap" style="width:5%">保单承保时间</th>
            <th nowrap="nowrap" style="width:5%">保单保险起期</th>
            <th nowrap="nowrap" style="width:5%">保单保险止期</th>
            <th nowrap="nowrap" style="width:5%">批增单申请时间</th>
            <th nowrap="nowrap" style="width:5%">批增单生效时间</th>
            <th nowrap="nowrap" style="width:5%">批增前签单保费</th>
            <th nowrap="nowrap" style="width:5%">批增后签单保费（针对魔方产品）</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <table class="table_02 orderTable" id="orderTable2" style="width: 3000px;display: none">
        <thead>
        <tr>
            <th nowrap="nowrap" style="width:5%">机构代码</th>
            <th nowrap="nowrap" style="width:5%">渠道代码</th>
            <th nowrap="nowrap" style="width:10%">机构名称</th>
            <th nowrap="nowrap" style="width:5%">渠道名称</th>
            <th nowrap="nowrap" style="width:5%">保单号</th>
            <th nowrap="nowrap" style="width:5%">批增单号（针对魔方产品）</th>
            <th nowrap="nowrap" style="width:5%">投保方案号</th>
            <th nowrap="nowrap" style="width:5%">投保方案名称</th>
            <th nowrap="nowrap" style="width:5%">4位产品代码</th>
            <th nowrap="nowrap" style="width:5%">保单状态</th>
            <th nowrap="nowrap" style="width:5%">缴费状态</th>
            <th nowrap="nowrap" style="width:5%">保单承保时间</th>
            <th nowrap="nowrap" style="width:5%">保单保险起期</th>
            <th nowrap="nowrap" style="width:5%">保单保险止期</th>
            <th nowrap="nowrap" style="width:5%">批增前签单保费</th>
            <th nowrap="nowrap" style="width:5%">批增后签单保费（针对魔方产品）</th>
            <th nowrap="nowrap" style="width:5%">分期实收期次</th>
            <th nowrap="nowrap" style="width:5%">分期本期实收用户金额</th>
            <th nowrap="nowrap" style="width:5%">实收金额对应原单/批单</th>
            <th nowrap="nowrap" style="width:5%">缴费类型</th>
            <th nowrap="nowrap" style="width:5%">分期缴费时间</th>

        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <table class="table_02 orderTable" id="orderTable3" style="width: 3000px;display: none">
        <thead>
        <tr>
            <th nowrap="nowrap" style="width:5%">机构代码</th>
            <th nowrap="nowrap" style="width:5%">渠道代码</th>
            <th nowrap="nowrap" style="width:10%">机构名称</th>
            <th nowrap="nowrap" style="width:5%">渠道名称</th>
            <th nowrap="nowrap" style="width:5%">保单号</th>
            <th nowrap="nowrap" style="width:5%">批增单号（针对魔方产品）</th>
            <th nowrap="nowrap" style="width:5%">投保方案号</th>
            <th nowrap="nowrap" style="width:5%">投保方案名称</th>
            <th nowrap="nowrap" style="width:5%">4位产品代码</th>
            <th nowrap="nowrap" style="width:5%">保单状态</th>
            <th nowrap="nowrap" style="width:5%">缴费状态</th>
            <th nowrap="nowrap" style="width:5%">保单承保时间</th>
            <th nowrap="nowrap" style="width:5%">保单保险起期</th>
            <th nowrap="nowrap" style="width:5%">保单保险止期</th>
            <th nowrap="nowrap" style="width:5%">批增单申请时间</th>
            <th nowrap="nowrap" style="width:5%">批增单生效时间</th>
            <th nowrap="nowrap" style="width:5%">批增前签单保费</th>
            <th nowrap="nowrap" style="width:5%">批增后签单保费（针对魔方产品）</th>

        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <table class="table_02 orderTable" id="orderTable4" style="width: 3000px;display: none">
        <thead>
        <tr>
            <th nowrap="nowrap" style="width:5%">机构代码</th>
            <th nowrap="nowrap" style="width:5%">渠道代码</th>
            <th nowrap="nowrap" style="width:10%">机构名称</th>
            <th nowrap="nowrap" style="width:5%">渠道名称</th>
            <th nowrap="nowrap" style="width:5%">保单号</th>
            <th nowrap="nowrap" style="width:5%">退保批减单号</th>
            <th nowrap="nowrap" style="width:5%">投保方案号</th>
            <th nowrap="nowrap" style="width:5%">投保方案名称</th>
            <th nowrap="nowrap" style="width:5%">4位产品代码</th>
            <th nowrap="nowrap" style="width:5%">保单状态</th>
            <th nowrap="nowrap" style="width:5%">缴费状态</th>
            <th nowrap="nowrap" style="width:5%">保单承保时间</th>
            <th nowrap="nowrap" style="width:5%">保单保险起期</th>
            <th nowrap="nowrap" style="width:5%">保单保险止期</th>
            <th nowrap="nowrap" style="width:5%">批增前签单保费</th>
            <th nowrap="nowrap" style="width:5%">批增后签单保费（针对魔方产品）</th>
            <th nowrap="nowrap" style="width:3%">分期实收期次</th>
            <th nowrap="nowrap" style="width:3%">分期本期实收用户金额</th>
            <th nowrap="nowrap" style="width:3%">实收金额对应原单/批单</th>
            <th nowrap="nowrap" style="width:3%">缴费类型</th>
            <th nowrap="nowrap" style="width:3%">分期缴费时间</th>
            <th nowrap="nowrap" style="width:3%">分期退费期次</th>
            <th nowrap="nowrap" style="width:3%">分期退费金额</th>

            <th nowrap="nowrap" style="width:3%">分期退保生效时间</th>
            <th nowrap="nowrap" style="width:3%">分期退保申请时间</th>
            <th nowrap="nowrap" style="width:3%">退保保费变化量</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <table class="table_02 orderTable" id="orderTable5" style="width: 3000px;display: none">
        <thead>
        <tr>
            <th nowrap="nowrap" style="width:5%">机构代码</th>
            <th nowrap="nowrap" style="width:5%">渠道代码</th>
            <th nowrap="nowrap" style="width:5%">保单是否已升级</th>
            <th nowrap="nowrap" style="width:10%">机构名称</th>
            <th nowrap="nowrap" style="width:5%">渠道名称</th>
            <th nowrap="nowrap" style="width:5%">保单号</th>
            <th nowrap="nowrap" style="width:5%">签单日期</th>
            <th nowrap="nowrap" style="width:5%">投保方案号</th>
            <th nowrap="nowrap" style="width:5%">4位产品代码</th>
            <th nowrap="nowrap" style="width:5%">保单保险起期</th>
            <th nowrap="nowrap" style="width:5%">批增单申请时间</th>
            <th nowrap="nowrap" style="width:5%">批改/承保</th>
            <th nowrap="nowrap" style="width:5%">对应升级生效期次</th>
            <th nowrap="nowrap" style="width:5%">批增单金额或保单金额</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>

<div id="orderPageDiv"  class="page"></div>

<!--选择 合作伙伴 div 默认隐藏-->
<div id="channelInfoDiv" style="display:none;width:80%;">
    <div class="table_title_div">
        <table class="table_title" style='width:100%;height: 20px;'>
            <tr>
                <td width="10%"></td>
                <td width="80%" id="interfaceName"></td>
                <td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('channelInfoDiv')"/></td>
            </tr>
        </table>
    </div>
    <table class="table_02" id="table" style="height:180px;" align="center">
        <tr>
            <td>
                <table class="search_table">
                    <tr height="30px">
                        <td colspan="3" style="text-align:center">
                            合作伙伴代码：<input name="txt3"  id="channelCode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
                            合作伙伴名称：<input name="txt3" id="channelName"  type="text" class="input_text" value="">&nbsp;&nbsp;
                            <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryTradPartners(1)"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table id="channelInfoTable"  class="content_table_1">
                    <thead>
                    <tr class="f1">
                        <th style="width:5%">选择</th>
                        <th style="width:10%">合作伙伴代码</th>
                        <th style="width:20%">合作伙伴名称</th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <div id="channelInfoPageDIV"  class="page"></div>
            </td>
        </tr>
    </table>
    <div align="center" >
        <input type="button" id="saveRoleBtn" value="确定" onclick="choosePartner()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
        <input type="button" value="取消" onclick="closeCurrentDIV('channelInfoDiv')" class="input_button_3"/>
    </div>
</div>

<div id="deptDiv" style="display:none;width:80%;">
    <!--   		<input type="hidden" id="row_num" name="row_num" value="0"/> -->
    <div class="table_title_div">
        <table class="table_title" style='width:100%;height: 20px;'>
            <tr>
                <td width="10%"></td>
                <td width="80%" id="interfaceName"></td>
                <td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('deptDiv')"/></td>
            </tr>
        </table>
    </div>
    <table class="table_02" id="table" style="height:180px;" align="center">
        <tr>
            <td>
                <table class="search_table">
                    <tr height="30px">
                        <td colspan="3" style="text-align:center">
                            出单机构代码：<input name="txt3"  id="deptCode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
                            出单机构名称：<input name="txt3" id="deptCname"  type="text" class="input_text" value="">
                            <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryCoreDept(1)"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table id="deptTable"  class="content_table_1">
                    <thead>
                    <tr class="f1">
                        <th style="width:5%">选择</th>
                        <th style="width:40%">出单机构代码</th>
                        <th style="width:55%">出单机构名称</th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <div id="deptPageDIV"  class="page"></div>
            </td>
        </tr>
    </table>
    <div align="center" >
        <input type="button" id="saveRoleBtn" value="确定" onclick="chooseDept()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
        <input type="button" value="取消" onclick="closeCurrentDIV('deptDiv')" class="input_button_3"/>
    </div>
</div>

<!-- 	 鼠标悬浮”合作伙伴、错误信息“时弹出层 -->
<div id="detail" style="display:none;">
    <div id="input" style="margin:5px;word-wrap:break-word;"></div>
</div>

<!-- 	 鼠标双击”合作伙伴、错误信息“时弹出层 -->
<div id="detail2" style="display:none;">
    <h4  style='background-color:#A4BDE3;'>
        <table height="20px">
            <tr>
                <td width="200px";>
                </td>
                <td align="right">
                    <img src="./images/closedown.gif"  onclick="closeDiv()"/>
                </td>
            </tr>
        </table>
        <input type="hidden" id="appId" value="">
    </h4>
    <div id="output" style="margin:5px;word-wrap:break-word;"></div>
</div>


<div id="policyListDiv" style="display: none;width: 90%;">
    <div class="table_title_div">
        <table class="table_title" style='width:100%;height: 20px;'>
            <tr>
                <td width="10%"></td>
                <td width="80%" id="interfaceName"></td>
                <td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('policyListDiv')"/></td>
            </tr>
        </table>
    </div>
    <table class="table_02" id="policyTable">
        <thead>
        <tr>
            <th style="width:15%" nowrap="nowrap">保单号</th>
            <th style="width:15%" nowrap="nowrap">投保单号</th>
            <th style="width:15%" nowrap="nowrap">投保方案</th>
            <th style="width:10%" nowrap="nowrap">含税保费</th>
            <th style="width:13%" nowrap="nowrap">起保日期</th>
            <th style="width:13%" nowrap="nowrap">终保日期</th>
            <th style="width:10%" nowrap="nowrap">保单状态</th>
            <th style="width:9%" nowrap="nowrap">产品大类</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
    <div id="policyPageDiv"  class="page"></div>
</div>

<%--subChannelTree(选择合作伙伴子机构层) --%>
<div id="subChannelTreeDiv" style="display: none;width:500px;margin-top: -50px" align="center">
    <div class="table_title_div">
        <table class="table_title" style='width:500px; height: 20px;'>
            <tr>
                <td width="10%"></td>
                <td width="80%" id="interfaceName"></td>
                <td width="10%" align="right"><img src="<%=path %>/images/closedown.gif" alt="关闭"  onclick="closeChannelTreeDiv()"/></td>
            </tr>
        </table>
    </div>

    <div style="height: 300px;width:500px; overflow:auto">
        <ul id="subChannelTree" class="ztree"></ul>
    </div>

    <div style="text-align: center;padding: 5px">
        <input type="button" id="choseChannelBtn" value="确定" onclick="chooseSubPartner()" class="input_button_1"/>&nbsp;&nbsp;&nbsp;
        <input type="button" value="取消" onclick="closeCurrentDIV('subChannelTreeDiv')" class="input_button_1"/>
    </div>
</div>
</body>
</html>
